package edu.mercer.sse.errors;

import com.google.common.base.Throwables;

import edu.mercer.sse.annotations.Fulfills;
import edu.mercer.sse.app.Config;

/**
 * Log exception.<p>
 *
 *
 * @see ErrorLogging
 */

public class ErrorLoggingVisitor implements ErrorLogging<String, Throwable>
{
	@Fulfills("ErrorLogging")
	@Override
	public String visit( final Throwable err ) 
	{
		final String errorMsg = err + "" + Throwables
				.getStackTraceAsString(err);
		
		if( Config.settings()
				  .getProperty("verbose")
				  .equalsIgnoreCase("true") ) System.err.println( errorMsg );
		
		CustomLogger log = LoggerCustom.obtainLog( "errors" );
		
		log.warning( errorMsg );
		
		return errorMsg;
	
	}//method


}//class